<template>
  <div>
    <ul>
      <li>
        <router-link :to="arr[0]">All_Contacts</router-link>
      </li>
      <li><router-link :to="arr[1]">Alice</router-link></li>
      <li><router-link :to="arr[2]">Bob</router-link></li>
    </ul>
    <button @click="$router.push(arr[Math.floor(Math.random() * 3)])">
      随机显示
    </button>
    <keep-alive>
      <router-view style="background-color: gold; padding: 20px"></router-view>
    </keep-alive>
  </div>
</template>

<script>
export default {
  data() {
    return {
      arr: ["/contacts/all_contacts", "/contacts/alice", "/contacts/bob"],
    };
  },
};
</script>

<style>
</style>